<?xml version="1.0" encoding="UTF-8"?>
<html>
<head>
<title>inputEx RPC</title>

<!-- YUI CSS -->
<link rel="stylesheet" type="text/css" href="../../lib/yui/reset-fonts/reset-fonts.css">
<link rel="stylesheet" type="text/css" href="../../lib/yui/container/assets/container.css"> 
<link rel="stylesheet" type="text/css" href="../../lib/yui/assets/skins/sam/skin.css">

<!-- InputEx CSS -->
<link type='text/css' rel='stylesheet' href='../../css/inputEx.css' />

<style>
#mainBox {
	margin:40px auto;
	width: 80%;
	background-color: #ccccff;
	padding: 20px;
}
p {
	margin: 10px;
	font-weight: bold;
}
</style>
</head>

<body class="yui-skin-sam">
	
	<div id='mainBox'>
		
		
		<p>Form generated from this SMD: <a href="smd/yahoo.smd">smd/yahoo.smd</a></p>
		<div id='formContainer'>
		</div>
		
		<p>Results :</p>
		<div id='treeContainer'>
		</div>
		
		<div style='clear: both;'></div>
		
	</div>

<!-- YUI -->
<script type="text/javascript" src="../../lib/yui/utilities/utilities.js"></script>
<script type="text/javascript" src="../../lib/yui/get/get-min.js"></script>
<script type="text/javascript" src="../../lib/yui/json/json-min.js"></script>

<!-- inputEx -->
<script type="text/javascript" src="../../js/inputex.js"></script>
<script type="text/javascript" src="../../js/mixins/choice.js"></script>
<script type="text/javascript" src="../../js/Field.js"></script>
<script type="text/javascript" src="../../js/Group.js"></script>
<script type="text/javascript" src="../../js/widgets/Button.js"></script>
<script type="text/javascript" src="../../js/Form.js"></script>
<script type="text/javascript" src="../../js/fields/StringField.js"></script>
<script type="text/javascript" src="../../js/fields/SelectField.js"></script>
<script type="text/javascript" src="../../js/fields/IntegerField.js"></script>
<script type="text/javascript" src="../../js/json-schema.js"></script> 
<script type="text/javascript" src="../../js/rpc/inputex-rpc.js"></script> 
<script type="text/javascript" src="../../js/widgets/json-tree-inspector.js"></script>

<script>

YAHOO.util.Event.onDOMReady(function() {

	/**
	 * generate a form from the service.questionSearch method
	 */
	var onServiceReady = function() {
		inputEx.RPC.generateServiceForm(service.questionSearch, { parentEl: 'formContainer' },{
				success: function(results) {
					var treeContainer = YAHOO.util.Dom.get('treeContainer');
					treeContainer.innerHTML = "";
					new inputEx.widget.JsonTreeInspector(treeContainer, results);
				}
			});
	}

	/**
	 * automatically creates service method from the smd description
	 */
	var service = new inputEx.RPC.Service("yahoo.smd",{ success: onServiceReady }	);

});

</script>

</body>
</html>
